# Princess Simulator — Event Designer

A visual, form-based editor for creating Princess Simulator event JSON files with **zero chance of errors**.

## Quick Start

1. **Double-click `run.bat`** — this starts the local server and opens your browser automatically.
2. Your browser will open to `http://localhost:31415`.
3. Design events visually. Save when done.

> Requires [Node.js](https://nodejs.org) installed (v14+). No other dependencies — pure built-in modules.

## Features

- **Visual forms** for every event field — no JSON syntax to get wrong
- **Pony dropdowns** — scans all mods and lists every character (33+ ponies), so you can never typo an ID
- **Every field & type supported**: speakers (fixed/random/from_world/from_participant), requirements (stats/flags/character states/tags/world), outcomes, dynamic outcomes (all 6 types), participants, daily rates, chaining, previews, text variants, event-level dynamic
- **Live validation** — catches missing `stat_changes`, invalid pony IDs, duplicate event IDs, and more, before you save
- **Multiple events per file** — sidebar manages a full list; add, duplicate, reorder, delete
- **Import existing files** — Open any existing event JSON to edit it visually
- **Dark mode** toggle (remembered between sessions)
- **JSON preview** — see exactly what will be written, copy to clipboard
- **Save anywhere** — write to any mod's `events/` folder

## How It Works

| Component | Role |
|-----------|------|
| `run.bat` | One-click launcher (starts server, opens browser) |
| `server.js` | Node backend: scans ponies/world/events from all mods, serves the UI, handles load/save |
| `public/index.html` | Editor page structure |
| `public/styles.css` | Clean modern styling + dark mode |
| `public/app.js` | All form logic, validation, JSON generation |

The server scans `../ContentAndMods/` (the sibling `ContentAndMods` folder) for all mods, merging ponies from every mod into one character list. Files are saved as a JSON array (matching the game's expected format) with 4-space indentation.

## File Structure Supported

```
princess-simulator/
  EventDesigner/        ← this tool (sibling of ContentAndMods)
    server.js
    run.bat
    public/
  ContentAndMods/
    base/               ← your game content
      events/*.json
      ponies/*.json
      portraits/*.png
    your_mod/           ← any other mod
      events/*.json
      ...
```

## Tips

- **Ctrl+S** to save quickly.
- Sections collapse — click headers to fold/unfold.
- The validation bar at the bottom shows errors (⛔) and warnings (⚠) in real time.
- Use **Preview JSON** to inspect/copy the exact output before saving.
- Participants (`%slot` substitution) and template variables (`{player_total}` etc.) are supported in text fields.